package com.xinan.system.meet;

import java.util.List;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

@TableBind(tableName = "tb_meet_teacher")
public class TbMeetTeacher extends Model<TbMeetTeacher> {

	private static final long serialVersionUID = 1L;

	public static final TbMeetTeacher dao = new TbMeetTeacher();

	// columns START
	private String ID = "id"; //
	private String NAME = "name"; // 姓名
	private String TEL = "tel"; // 手机号
	private String EMAIL = "email"; // email
	private String BIRTH = "birth"; // 生日
	private String LEVEL = "level"; // 级别：主讲、宣讲
	private String IMG = "img"; // 照片
	private String CONTENT = "content"; // 简介
	private String CREATEID = "createid"; //
	private String CREATETIME = "createtime"; //

	public void setId(int value) {
		set(ID, value);
	}

	public int getId() {
		return get(ID);
	}

	public void setName(String value) {
		set(NAME, value);
	}

	public String getName() {
		return get(NAME);
	}

	public void setTel(String value) {
		set(TEL, value);
	}

	public String getTel() {
		return get(TEL);
	}

	public void setEmail(String value) {
		set(EMAIL, value);
	}

	public String getEmail() {
		return get(EMAIL);
	}

	public void setBirth(String value) {
		set(BIRTH, value);
	}

	public String getBirth() {
		return get(BIRTH);
	}

	public void setLevel(String value) {
		set(LEVEL, value);
	}

	public String getLevel() {
		return get(LEVEL);
	}

	public void setImg(String value) {
		set(IMG, value);
	}

	public String getImg() {
		return get(IMG);
	}

	public void setContent(String value) {
		set(CONTENT, value);
	}

	public String getContent() {
		return get(CONTENT);
	}

	public void setCreateid(int value) {
		set(CREATEID, value);
	}

	public int getCreateid() {
		return get(CREATEID);
	}

	public void setCreatetime(String value) {
		set(CREATETIME, value);
	}

	public String getCreatetime() {
		return get(CREATETIME);
	}

	// columns END

	public List<TbMeetTeacher> findAll() {
		return find("select * from tb_meet_teacher");
	}

	/**
	 * @param where
	 * @return Record
	 */
	public List<Record> findAlls(String where) {
		String sqlExp = " from tb_meet_teacher";
		if (StrKit.notBlank(where)) {
			sqlExp += " where " + where;
		}
		return Db.find("select * " + sqlExp);

	}

	public Page<TbMeetTeacher> page(int pageNumber, int pageSize, String where) {
		String sqlExp = "from tb_meet_teacher";
		if (StrKit.notBlank(where)) {
			sqlExp += " where " + where;
		}
		return paginate(pageNumber, pageSize, "select *", sqlExp);
	}

	/**
	 * 老师选择框
	 * 
	 * @date 2015年4月9日 下午4:28:35
	 * @author FLY的狐狸 369191470@qq.com
	 * @return
	 */
	public List<Record> findAllSelect() {
		return Db.find("select id,name as text from tb_meet_teacher");
	}

}
